Skip to content

ci: cancel PR runs only for new commits - #129

Merged
uniqueg merged 2 commits into
mainfrom
ci/gate-cancel-new-commits
Nov 11, 2026
Merged

uniqueg merged 2 commits into
mainfrom
ci/gate-cancel-new-commits

Conversation

@uniqueg

@uniqueg uniqueg commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

Summary

Only a new head commit of a pull request now cancels its CI runs in progress: cancel-in-progress of the workflow-level concurrency block in .github/workflows/ci.yml is true only for pull_request with action synchronize on the first attempt, as in "Cancelled runs" of actions/gate/README.md in elixir-cloud-aai/.github (elixir-cloud-aai/.github#71):

cancel-in-progress: >-
  ${{ github.event_name == 'pull_request'
  && github.event.action == 'synchronize'
  && github.run_attempt == 1 }}

Before, a newer run on the same commit (e.g. for editing the description, also by Sourcery, or marking the pull request ready) cancelled the run in progress, and its failed CI passed was then the newest result on the commit, which blocked the merge (elixir-cloud-aai/.github#70). Runs for other actions, and reruns, now wait for the run in progress instead; a waiting run that is replaced starts no job, so it leaves no check. The gate keeps if: always(), so a needed job that failed or was cancelled still fails it. This pull request's own runs already use the new rule.

Runs for pushes to main now also get a group of their own (github.sha), as in the README, so that a waiting push run is no longer replaced by a newer one; pull request runs keep the group per ref. A comment above the block describes the rule.

Part of elixir-cloud-aai/.github#73

Verification

  • actionlint and check-yaml (hooks of cloud-registry's pre-commit config, as this repository has none) on .github/workflows/ci.yml: passed.
  • CI: all checks passed, including CI passed, on e3ea8c7.
  • Sourcery: 1 thread (a body-edit run replacing a waiting title-edit run of a Dependabot pull request): answered, not changed (waiting runs were replaced before too; the title check's condition is outside this rollout), resolved.

Light lane: changes only the CI workflow's concurrency settings (no secrets, permissions or release workflow); I reviewed the diff myself.

Declined review findings

None.

Open questions

None.

🤖 Generated with Claude Code

https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV

Summary by Sourcery

Ensure CI cancellation is limited to new pull-request commits while preserving independent push runs and reliable merge checks.

Bug Fixes:

  • Prevent CI runs for the same pull-request commit from being cancelled by metadata-only events or reruns, avoiding stale failed CI passed checks from blocking merges.

Enhancements:

  • Retain cancellation only for first-attempt runs triggered by new pull-request commits and isolate push-to-main runs by commit so queued runs are not replaced.

CI:

  • Update CI workflow concurrency grouping and cancellation rules to handle pull-request commits, other pull-request events, reruns, and pushes appropriately.

A newer run on the same commit (e.g. for an edit of the description)
cancelled the run in progress, and its failed gate then blocked the
merge. Only the first attempt of a run for a pull request's
synchronize action now cancels runs in progress, as in "Cancelled
runs" of actions/gate/README.md in elixir-cloud-aai/.github.

Part of elixir-cloud-aai/.github#73

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
@read-the-docs-community

read-the-docs-community Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Documentation build overview

📚 elixir-on-cloud-docs | 🛠️ Build #35809138 | 📁 Comparing a6b6bb2 against latest (ab16c65)

  🔍 Preview build  

No files changed.

@uniqueg
uniqueg marked this pull request as ready for review November 10, 2026 20:03
@sourcery-ai

sourcery-ai Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Configuration

Update CI concurrency groups so push runs are keyed by commit and only a first-attempt pull-request synchronize run cancels in-progress runs.

  • .github/workflows/ci.yml L18-30

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path=".github/workflows/ci.yml" line_range="27-30" />
<code_context>
-  cancel-in-progress: ${{ github.event_name == 'pull_request' }}
+  group: >-
+    ci-${{ github.event_name == 'push' && github.sha || github.ref }}
+  cancel-in-progress: >-
+    ${{ github.event_name == 'pull_request'
+    && github.event.action == 'synchronize'
+    && github.run_attempt == 1 }}

 jobs:
</code_context>
<issue_to_address>
**Invalid bot-PR title can pass**

When a user edits a Dependabot PR title while another run occupies its concurrency group, then edits the PR body before title validation starts, the body-edit run replaces the pending title-validation run; `title` is skipped by its condition and `passed` allows that skip, so the gate succeeds without validating the new title and the invalid title can merge.

Prevent later body-edit runs from replacing required title-validation runs, or make those runs validate the current title.
</issue_to_address>

Sourcery assessment

Approval pending. 1 finding to address first.

Blocking findings: .github/workflows/ci.yml:30


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread .github/workflows/ci.yml Resolved
@uniqueg
uniqueg merged commit 8c029cf into main Nov 11, 2026
13 checks passed
@uniqueg
uniqueg deleted the ci/gate-cancel-new-commits branch November 11, 2026 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant